﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.IO;
using System.Reflection;
using System.Text;
using System.Windows.Forms;

using agsXMPP;
using agsXMPP.Xml;
using agsXMPP.Xml.Dom;
using agsXMPP.protocol.iq.disco;

namespace JabberVK
{
    public partial class frLogin : Form
    {
        private XmppClientConnection _connection;

        public frLogin(XmppClientConnection con)
        {
            InitializeComponent();
            this.DialogResult = DialogResult.Cancel;
            _connection = con;
        }

        private void btLogin_Click(object sender, EventArgs e)
        {
            Jid jid = new Jid(txtJabberID.Text);
            _connection.Server = jid.Server;
            _connection.Username = jid.User;
            _connection.Password = txtJabberPass.Text;
            _connection.Resource = txtResource.Text;

            this.DialogResult = DialogResult.OK;
            this.Close();
        }

        private void btCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
        }

        private void btCheck_Click(object sender, EventArgs e)
        {

        }

        private string SettingsFile
        {
            get
            {
                string path=Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
                return path+@"\Settings.xml";
            }
        }

        private void SaveSettings()
        {
            Document d = new Document();

            
            
            
        }
    }
}
